package com.crm.pojo;

import java.io.Serializable;
import javax.persistence.*;

import com.alibaba.fastjson.annotation.JSONField;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the CONTRACT database table.
 * 
 */
@Entity
@NamedQuery(name="Contract.findAll", query="SELECT c FROM Contract c")
public class Contract implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(initialValue = 1, allocationSize = 1,name="CONTRACT_CONTRACTID_GENERATOR", sequenceName="SEQ3")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="CONTRACT_CONTRACTID_GENERATOR")
	@Column(name="CONTRACT_ID")
	private Long contractId;

	@Column(name="CONTRACT_ACCESSORY")
	private String contractAccessory;

	@Column(name="CONTRACT_ADDRESS")
	private String contractAddress;

	@Column(name="CONTRACT_CHECK")
	private String contractCheck;

	@Column(name="CONTRACT_CUSTOMER")
	private String contractCustomer;

	@Temporal(TemporalType.DATE)
	@Column(name="CONTRACT_DO_TIME")
	@JSONField(format="yyyy-MM-dd")
	private Date contractDoTime;

	@Column(name="CONTRACT_EMPNO")
	private BigDecimal contractEmpno;

	@Column(name="CONTRACT_IS_DEL")
	private String contractIsDel;

	@Column(name="CONTRACT_IS_REFUND")
	private String contractIsRefund;

	@Column(name="CONTRACT_MONEY")
	private BigDecimal contractMoney;

	@Column(name="CONTRACT_NUMBER")
	private BigDecimal contractNumber;

	@Column(name="CONTRACT_REMARK")
	private String contractRemark;

	@Column(name="CONTRACT_STATE")
	private String contractState;

	@Column(name="CONTRACT_TOPIC")
	private String contractTopic;

	@Column(name="FK_CUSTOMER_ID")
	private BigDecimal fkCustomerId;

	@Column(name="FK_PLAN_ID")
	private BigDecimal fkPlanId;

	@Column(name="ORDER_BACK_MONEY")
	private BigDecimal orderBackMoney;

	@Temporal(TemporalType.DATE)
	@Column(name="ORDER_OVER_TIME")
	@JSONField(format="yyyy-MM-dd")
	private Date orderOverTime;

	@Temporal(TemporalType.DATE)
	@Column(name="ORDER_START_TIME")
	@JSONField(format="yyyy-MM-dd")
	private Date orderStartTime;

	//bi-directional many-to-one association to CODetail
	@OneToMany(mappedBy="contract")
	@JSONField(serialize = false)
	private List<CODetail> CODetails;

	public Contract() {
	}

	public Long getContractId() {
		return this.contractId;
	}

	public void setContractId(Long contractId) {
		this.contractId = contractId;
	}

	public String getContractAccessory() {
		return this.contractAccessory;
	}

	public void setContractAccessory(String contractAccessory) {
		this.contractAccessory = contractAccessory;
	}

	public String getContractAddress() {
		return this.contractAddress;
	}

	public void setContractAddress(String contractAddress) {
		this.contractAddress = contractAddress;
	}

	public String getContractCheck() {
		return this.contractCheck;
	}

	public void setContractCheck(String contractCheck) {
		this.contractCheck = contractCheck;
	}

	public String getContractCustomer() {
		return this.contractCustomer;
	}

	public void setContractCustomer(String contractCustomer) {
		this.contractCustomer = contractCustomer;
	}

	public Date getContractDoTime() {
		return this.contractDoTime;
	}

	public void setContractDoTime(Date contractDoTime) {
		this.contractDoTime = contractDoTime;
	}

	public BigDecimal getContractEmpno() {
		return this.contractEmpno;
	}

	public void setContractEmpno(BigDecimal contractEmpno) {
		this.contractEmpno = contractEmpno;
	}

	public String getContractIsDel() {
		return this.contractIsDel;
	}

	public void setContractIsDel(String contractIsDel) {
		this.contractIsDel = contractIsDel;
	}

	public String getContractIsRefund() {
		return this.contractIsRefund;
	}

	public void setContractIsRefund(String contractIsRefund) {
		this.contractIsRefund = contractIsRefund;
	}

	public BigDecimal getContractMoney() {
		return this.contractMoney;
	}

	public void setContractMoney(BigDecimal contractMoney) {
		this.contractMoney = contractMoney;
	}

	public BigDecimal getContractNumber() {
		return this.contractNumber;
	}

	public void setContractNumber(BigDecimal contractNumber) {
		this.contractNumber = contractNumber;
	}

	public String getContractRemark() {
		return this.contractRemark;
	}

	public void setContractRemark(String contractRemark) {
		this.contractRemark = contractRemark;
	}

	public String getContractState() {
		return this.contractState;
	}

	public void setContractState(String contractState) {
		this.contractState = contractState;
	}

	public String getContractTopic() {
		return this.contractTopic;
	}

	public void setContractTopic(String contractTopic) {
		this.contractTopic = contractTopic;
	}

	public BigDecimal getFkCustomerId() {
		return this.fkCustomerId;
	}

	public void setFkCustomerId(BigDecimal fkCustomerId) {
		this.fkCustomerId = fkCustomerId;
	}

	public BigDecimal getFkPlanId() {
		return this.fkPlanId;
	}

	public void setFkPlanId(BigDecimal fkPlanId) {
		this.fkPlanId = fkPlanId;
	}

	public BigDecimal getOrderBackMoney() {
		return this.orderBackMoney;
	}

	public void setOrderBackMoney(BigDecimal orderBackMoney) {
		this.orderBackMoney = orderBackMoney;
	}

	public Date getOrderOverTime() {
		return this.orderOverTime;
	}

	public void setOrderOverTime(Date orderOverTime) {
		this.orderOverTime = orderOverTime;
	}

	public Date getOrderStartTime() {
		return this.orderStartTime;
	}

	public void setOrderStartTime(Date orderStartTime) {
		this.orderStartTime = orderStartTime;
	}

	public List<CODetail> getCODetails() {
		return this.CODetails;
	}

	public void setCODetails(List<CODetail> CODetails) {
		this.CODetails = CODetails;
	}

	public CODetail addCODetail(CODetail CODetail) {
		getCODetails().add(CODetail);
		CODetail.setContract(this);

		return CODetail;
	}

	public CODetail removeCODetail(CODetail CODetail) {
		getCODetails().remove(CODetail);
		CODetail.setContract(null);

		return CODetail;
	}

	@Override
	public String toString() {
		return "Contract{" +
				"contractId=" + contractId +
				", contractAccessory='" + contractAccessory + '\'' +
				", contractAddress='" + contractAddress + '\'' +
				", contractCheck='" + contractCheck + '\'' +
				", contractCustomer='" + contractCustomer + '\'' +
				", contractDoTime=" + contractDoTime +
				", contractEmpno=" + contractEmpno +
				", contractIsDel='" + contractIsDel + '\'' +
				", contractIsRefund='" + contractIsRefund + '\'' +
				", contractMoney=" + contractMoney +
				", contractNumber=" + contractNumber +
				", contractRemark='" + contractRemark + '\'' +
				", contractState='" + contractState + '\'' +
				", contractTopic='" + contractTopic + '\'' +
				", fkCustomerId=" + fkCustomerId +
				", fkPlanId=" + fkPlanId +
				", orderBackMoney=" + orderBackMoney +
				", orderOverTime=" + orderOverTime +
				", orderStartTime=" + orderStartTime +
				'}';
	}
}